import java.util.ArrayList;
public class FractionExpression {
    private ArrayList<Fraction> num = new ArrayList<Fraction>();
    private String[] operation = {"+", "-", "x", "/"};
    private String op;
    public FractionExpression(){
        num.add(initItem());
        num.add(initItem());
        op = initOp();
    }
    public Fraction getValue(){
        switch (op.charAt(0)){
            case '+':return Operator.Add(num.get(0),num.get(1));
            case '-':return Operator.Minus(num.get(0),num.get(1));
            case 'x':return Operator.Multi(num.get(0),num.get(1));
            case '/':return Operator.Divide(num.get(0),num.get(1));
        }
        return new Fraction(0,0);
    }
    @Override
    public String toString(){
        return num.get(0) + " " + op + " " + num.get(1);
    }
    protected  String initOp(){
        return operation[(int) (Math.random() * operation.length)];
    }
    protected  Fraction initItem(){
        return new Fraction((int) (Math.random() * 10 + 1),(int) (Math.random() * 10)+1);
    }
}
